UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Xpd+h8mz5/b+kcZhtOmc8Vd+d07n3WL0UGDQ5Z0p9rs=' 
WHERE 
  key_id = '712b0d3d55fd294778b5f946b69438156601411b88598a3975b231f873197cf9' 
  AND (
    token = 'Xpd+h8mz5/b+kcZhtOmc8Vd+d07n3WL0UGDQ5Z0p9rs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016