UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kwY4rtL91DqQnl726JoBYRK8/YYUr/LufDG3fVYxW78='
WHERE
key_id = 'dc623d903a4e1c80c6fa109e37931579bb812f5d5d613a79e8fae23d2bb60cf9'
AND (
token = 'kwY4rtL91DqQnl726JoBYRK8/YYUr/LufDG3fVYxW78='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)