UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z8bey+xeux6rly5mu0CMXupsC6cOSOszKrqzQzMils8='
WHERE
key_id = 'a66891eba8bf589de13663846cd504e1409e5917760569ed900ad8806bc09fe5'
AND (
token = 'Z8bey+xeux6rly5mu0CMXupsC6cOSOszKrqzQzMils8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)