UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'E33y/trRcEAcCjal+oWdsFjqnuV86UVuZAtEIzZS4Dg='
WHERE
key_id = 'afe5b1566529236be1ea721238f4e32fefa95e106c9c5791c4176a10053ed008'
AND (
token = 'E33y/trRcEAcCjal+oWdsFjqnuV86UVuZAtEIzZS4Dg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)