UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'I7d2YNitcjsrC5kpEQO1Hei5QgjpDD/1f+4qGZCtRuI='
WHERE
key_id = 'b6e57b27a9b6583b3bd54a6fb3af60d17df76588bbe256247c2665893ed68497'
AND (
token = 'I7d2YNitcjsrC5kpEQO1Hei5QgjpDD/1f+4qGZCtRuI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)