UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jM6X4bp5+y7vpLpg6QyMNsGKgdfHCKIt5wiYsVpeaDs=' 
WHERE 
  key_id = '7d989269983c257e89b3aef716ae1888872fab664b29fc7e9267a697a79b5572' 
  AND (
    token = 'jM6X4bp5+y7vpLpg6QyMNsGKgdfHCKIt5wiYsVpeaDs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042