UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N6tlGwLWYCiPnmN7kmy/QEiDzpPEeCi16Gc7C9qaFm8=' 
WHERE 
  key_id = '4356559c777801e2f66244cbeace29cf2451626a5fa1c9b4201abd1c4fa0ab7e' 
  AND (
    token = 'N6tlGwLWYCiPnmN7kmy/QEiDzpPEeCi16Gc7C9qaFm8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033