UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gNoqlRcxfXjLEZb8owFSH1MmM29u+YX2jQ8fe+ZIPjg='
WHERE
key_id = '6414ce29fdb3979198a340c0dd84be2140f2315b88498c21f1268e1cb9184fde'
AND (
token = 'gNoqlRcxfXjLEZb8owFSH1MmM29u+YX2jQ8fe+ZIPjg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)