UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lC22BCDTu3IOO5wKlabGHZW+f6AGoBcdMPUP6jBCkig='
WHERE
key_id = '4ef8bb0449d355ef26d37a32640c7b46afc346859c42c3430c012bc3c70e381a'
AND (
token = 'lC22BCDTu3IOO5wKlabGHZW+f6AGoBcdMPUP6jBCkig='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)