UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '52laUEmADrpHGhZtyXFtNKc0lbO8fxQmQX1Efi2XG40='
WHERE
key_id = '9fdfdc1760130c56faf60e93bde34c4e578406a8a2fd7e5afe0d260e8ccd4f6c'
AND (
token = '52laUEmADrpHGhZtyXFtNKc0lbO8fxQmQX1Efi2XG40='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)