UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iVvpPmKvSbu3eC6biKlCauuW3ttPJrOZOVP3gtGxW1E='
WHERE
key_id = 'dd28657c6cb80731b679c80910f6a441cc458cc1f3eb669317e0e58ce63e5bd5'
AND (
token = 'iVvpPmKvSbu3eC6biKlCauuW3ttPJrOZOVP3gtGxW1E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)