UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qlN2g/PB4F247yJZLYNrvm0SS5iVYwnEsJAO7gHrAHE='
WHERE
key_id = '2109dd9ac499456ed6827e5019b19b6d2132d5806bcab992c362e1877162256e'
AND (
token = 'qlN2g/PB4F247yJZLYNrvm0SS5iVYwnEsJAO7gHrAHE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)