UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YgfYIVgbCGrKAag59S2NwGMnr3zQhkRCF/3atxzVs18='
WHERE
key_id = 'eaf11897a40272acaeb60eb859116478c1d9e2727187e5bd4324303526f3ac7f'
AND (
token = 'YgfYIVgbCGrKAag59S2NwGMnr3zQhkRCF/3atxzVs18='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)