UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CM5SU0b+x1vlCJ9v7+mT71OUWBwUru24lzbWeJ7q+Hw='
WHERE
key_id = 'a4da07bbee5ec21ba29885d6f22d485448e8e8842ad51f6291cd544cad8f9c01'
AND (
token = 'CM5SU0b+x1vlCJ9v7+mT71OUWBwUru24lzbWeJ7q+Hw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)