UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '60s971O8wBVSvtFH/78hD3hgfA3MY1uFatA3CJHps+4=' 
WHERE 
  key_id = '8edc7174ecf8686563fbcb92bc73f341e8e551f0badcc782b1427badc195fdb7' 
  AND (
    token = '60s971O8wBVSvtFH/78hD3hgfA3MY1uFatA3CJHps+4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048