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