UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Bc0sKyPiv51Wc1u20MdZ/3MQG7TChBZ9WOC46CAYPSw='
WHERE
key_id = 'dbaac01862d11e027ea0c18b1f2c7ae3d28c347c0807c74efb103422efde5ed3'
AND (
token = 'Bc0sKyPiv51Wc1u20MdZ/3MQG7TChBZ9WOC46CAYPSw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)