UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GFlTsL44scNhAqljyC54WH1y1NwAVuxKy2tycP9Gv6g='
WHERE
key_id = 'aa4813ad23d0c975cae0832eb8729eeb6aabcb3c24f1473c32093ac8e923f34a'
AND (
token = 'GFlTsL44scNhAqljyC54WH1y1NwAVuxKy2tycP9Gv6g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)