UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a6CiVHBBf+5NIO6orbQpodbSzMpR0LxQNNe5U3cG9vk='
WHERE
key_id = 'f8e814e91a23c2607b3fc259799200656b986abc75ca13f012e2c4f44a3ccb77'
AND (
token = 'a6CiVHBBf+5NIO6orbQpodbSzMpR0LxQNNe5U3cG9vk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)