UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HdmXyDQZ+/frEaXA5NBcLvuisIrxwnoXPoqp6A+dXlM='
WHERE
key_id = '9a55eae85966a4e526d00d30c41729a4b9d2ac608ea60b8e6dc8dcc159a9ea30'
AND (
token = 'HdmXyDQZ+/frEaXA5NBcLvuisIrxwnoXPoqp6A+dXlM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)