UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '38Nm+bn67MiP9O66Dx0TbWj8dYMok1R7Pwp1PBqcFB4=' 
WHERE 
  key_id = 'be93f16055845ee3fa9d9cbbc54728763d34502b584be2c1678ab9a373a95dd9' 
  AND (
    token = '38Nm+bn67MiP9O66Dx0TbWj8dYMok1R7Pwp1PBqcFB4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00064