UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T1XKpxnAamZzuH4PZW0cvxtPiLEFIhN3kQzYcqn7uzA=' 
WHERE 
  key_id = '9fe97f8f52ba787f93788e404e2c0a8bb28512c38901263b1fe59eb80b6c5476' 
  AND (
    token = 'T1XKpxnAamZzuH4PZW0cvxtPiLEFIhN3kQzYcqn7uzA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023