UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AyFmNuhNvHtrPBB3PUD2IxqaNgUF6qSqANtFAUhCyRE='
WHERE
key_id = '1589a94c5701b1c2af233768b1509d7d6890bed24b3645cc7cc20fe0a8f13ed0'
AND (
token = 'AyFmNuhNvHtrPBB3PUD2IxqaNgUF6qSqANtFAUhCyRE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)