UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZVc+J2P0d9aDwfCz7WYJhOR2fVvWzHSYpDMpcAFQrTc=' 
WHERE 
  key_id = '3f838a80e1dcaa64e1504e29ca61653fdd8752049c6d9b516cddb62c98746e8a' 
  AND (
    token = 'ZVc+J2P0d9aDwfCz7WYJhOR2fVvWzHSYpDMpcAFQrTc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039