UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hLgbtCbvRtMixmVPyknd53R3ID+/D8TaaVVue2jNBNw=' 
WHERE 
  key_id = '90a0208bfca8a0820918c29af098280fd7fac43eb0f654c2e309b4c0c08a502f' 
  AND (
    token = 'hLgbtCbvRtMixmVPyknd53R3ID+/D8TaaVVue2jNBNw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040