UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y7C67NRcup9mthf3q3IVY0veA4vySx58EuPMe1Evmao=' 
WHERE 
  key_id = 'e3bd8f0fadd3fb0d47c3b87b37c590249765c6b0a0ac5bc995968f84d05293d6' 
  AND (
    token = 'y7C67NRcup9mthf3q3IVY0veA4vySx58EuPMe1Evmao=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030