UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dfloYLf8/+A8UpqjoddTTfwnzoBYY9RcBAjwo/uSIiA='
WHERE
key_id = '9c988e6e178c0795cc864533ea7a933f20173f8f6f1dc7edf6b628077b3cb201'
AND (
token = 'dfloYLf8/+A8UpqjoddTTfwnzoBYY9RcBAjwo/uSIiA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)