UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iUBATfB/vak0dJgH9EwvR6jJxFNRw5P8dvtSL9eJ3i0='
WHERE
key_id = 'b8494b0ff5c87f9b660abe7cea4be244162934aec772b8135f92e590d364a273'
AND (
token = 'iUBATfB/vak0dJgH9EwvR6jJxFNRw5P8dvtSL9eJ3i0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)