UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BfLaSiPiEzu3kmfNWQwogUuEmMoEaqD29a6+ynfw1S4='
WHERE
key_id = 'b6096e4f4ab82a0a04c7c94724f31fc040c34b9ebaa4a0c1848dddf25d103185'
AND (
token = 'BfLaSiPiEzu3kmfNWQwogUuEmMoEaqD29a6+ynfw1S4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)