UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QNI+jX+0wKmyi1c3dSTywM2gWZ6cwlDt7k6tB4SbFJU=' 
WHERE 
  key_id = 'c6087bcebde976fdb4cc767a4e5afa95245916ec86eb51cfd6051093d8194a5b' 
  AND (
    token = 'QNI+jX+0wKmyi1c3dSTywM2gWZ6cwlDt7k6tB4SbFJU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031