UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rYr6N1nrA2tm8/V9MXDO1Idb2zvt85hRNAta19qBHQA='
WHERE
key_id = '46fb7368e346c3ea47df52070e8e364a25d6c0112271e6acfeba6eec2a163c9c'
AND (
token = 'rYr6N1nrA2tm8/V9MXDO1Idb2zvt85hRNAta19qBHQA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)