UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lH9sdbl4dZMCpg0PKCpXS/TmCvsB6k7N+SAOZa5iQxo=' 
WHERE 
  key_id = 'd418be8bc148bba00aaede03f8755665be685dd31c5757613f562c12868841c3' 
  AND (
    token = 'lH9sdbl4dZMCpg0PKCpXS/TmCvsB6k7N+SAOZa5iQxo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028