UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a2L5OjY7XDcPJzzJ6GVZrkQm69kXvdlmMx9qNuMxhIk='
WHERE
key_id = '8f65b3282895c8d521437f20c40a33f54cb65e25d18a8b8b9bf4995f9608db77'
AND (
token = 'a2L5OjY7XDcPJzzJ6GVZrkQm69kXvdlmMx9qNuMxhIk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)