UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WiSajlvM/98CYfP7vtTv2XnwkRHAZspwnDHOzU8Ho2Y=' 
WHERE 
  key_id = '40f99edd3605328b8deabc0cc32e8431c2d9fe19d8af580a4b312e12780efd06' 
  AND (
    token = 'WiSajlvM/98CYfP7vtTv2XnwkRHAZspwnDHOzU8Ho2Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041