UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6EQpXnrhZkT0+MhXct+IT+gKY1mIm5JefM4VCMY5vzI='
WHERE
key_id = '98dde4e77b833147a4fb6529e99a26924eb9793febedc66d8a86816b1afe49cd'
AND (
token = '6EQpXnrhZkT0+MhXct+IT+gKY1mIm5JefM4VCMY5vzI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)