UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DUN3yIlvUFWvVkUCjgU3ubvtwapEJmf780k+kT7IYfU='
WHERE
key_id = 'ca7052008c7fcc46bc6efc3a63cc9dbe7166d8f3c4b7ecee0aca077d248ced7f'
AND (
token = 'DUN3yIlvUFWvVkUCjgU3ubvtwapEJmf780k+kT7IYfU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)