UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QeBz0YfDfKkoeioIpDC2e6ypp96LUHDCZ/EQOxFTDYw='
WHERE
key_id = '5ee99b7e12ed355d7f71cb118d4412871660143c6abf797f8ae9a652495ebc12'
AND (
token = 'QeBz0YfDfKkoeioIpDC2e6ypp96LUHDCZ/EQOxFTDYw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)