UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hLoM9vM3dFTLe5YizMeYiUh4jcoAuwiSFWBVV28HlIU='
WHERE
key_id = '9ec58732e92e2453320e81d809e87781eb5aa7c13f06d7c721407e26f655f326'
AND (
token = 'hLoM9vM3dFTLe5YizMeYiUh4jcoAuwiSFWBVV28HlIU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)