UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iO9FJUy7w1q4ZcY/UIINYVe+o8FSH3eKoocjDn3SlsY='
WHERE
key_id = 'a5e26874daebdc8c00620608399145238b590c2bc36e4d84d5cc38752b892ff0'
AND (
token = 'iO9FJUy7w1q4ZcY/UIINYVe+o8FSH3eKoocjDn3SlsY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)