UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lJw1CxmZBBJsgmCEWvRLnYLgxM6AmFD56LFm3AUoyUk=' 
WHERE 
  key_id = '85b9c15c04868c27658e36081ce50ec8380e3cc9be89ed0eecebe98832bdd165' 
  AND (
    token = 'lJw1CxmZBBJsgmCEWvRLnYLgxM6AmFD56LFm3AUoyUk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017