UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qW3xjdRtA8bRLsSShUw4JVlUADpHZaRPOitikprSiLQ='
WHERE
key_id = '2001297b14a6f862badc5bbe87ceff85dc40a68f14393a00b7a4b3a5bb334b7c'
AND (
token = 'qW3xjdRtA8bRLsSShUw4JVlUADpHZaRPOitikprSiLQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)