UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WxaKoAwxxHKxjhzIcNs6lRPmJ3Ga7FhbMsw0T+H9pt4='
WHERE
key_id = '25291b7e729300501ecb9e9d318110ff242d9e38387a2b0c6102e3c62ab1503e'
AND (
token = 'WxaKoAwxxHKxjhzIcNs6lRPmJ3Ga7FhbMsw0T+H9pt4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)