UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tAgX05un73MDRsTzanVTxabwfW/038mXJONjDlKaDmQ=' 
WHERE 
  key_id = '7a45595336d7d702b2e766dbb31172a419cb2866411152629e8844229fb3c286' 
  AND (
    token = 'tAgX05un73MDRsTzanVTxabwfW/038mXJONjDlKaDmQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054