UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+7pqD9TlNovLGZOAem5ggQAch/uET6dIe9V4pLn1ck8=' 
WHERE 
  key_id = '33593bcf3fd121167680339d3467d6e0eb9ff4588733d52a3a01edeece4dced6' 
  AND (
    token = '+7pqD9TlNovLGZOAem5ggQAch/uET6dIe9V4pLn1ck8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035