UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'P/wGmgKLanOmu1AKNh6t2l2qlI6z6NllC5XWAhU5EO0='
WHERE
key_id = '4c8340647ffed30749ee0ca0dba9266570eb8415437f1a3657911fdb07c5bca2'
AND (
token = 'P/wGmgKLanOmu1AKNh6t2l2qlI6z6NllC5XWAhU5EO0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)