UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EFRwFQDMb22zxdYICsQujG+ajmgBjismlDYnyjXGVZI='
WHERE
key_id = '39b960fe1aae61119b485c002c9937c19f6b673e41f82a7f420fef5de0298987'
AND (
token = 'EFRwFQDMb22zxdYICsQujG+ajmgBjismlDYnyjXGVZI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)