UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'maREc2lwtR2/7RMna/HZNwiw+NJaGira1mBAC6tjofY=' 
WHERE 
  key_id = 'e06557eb7a82a2e108f4034f9132bc7c757c9cc34cb8172fbfa5ab5cf4fb0f9c' 
  AND (
    token = 'maREc2lwtR2/7RMna/HZNwiw+NJaGira1mBAC6tjofY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037